<?php
namespace Home\Common;
use Home\Common\BasicController;

class AuthController extends BasicController
{
	public function _initialize()
    {
        $this->check_login_state();
    }

    function _empty(){
        $this->display();
    }

    /**
     * [check_login_state 检测登录状态 没有登录跳转登录页]
     * @Author   Limx
     * @Method   直接调用
     * @DateTime 2015-12-09T17:49:21+0800
     * @return   [type]                   [description]
     */
    protected function check_login_state()
    {
        if (empty($_SESSION[self::USER_ID])) {
            $this->redirect("Login/login");
        }
    }

    /**
     * [check_admin_auth 判断管理员权限]
     * @author limx
     * @param array $arr
     */
    protected function check_admin_auth($arr=array(0)){
        $auth = session("Auth");
        if(!in_array($auth,$arr)){
            $this->error("暂无权限！","/Home/Index/index");
        }

    }
   
}